java get element occurrences in a list java

50

how to count the number of occurrences of an element in a arraylist in java -

int occurrences = Collections.frequency(animals, "bat");

Comments

Submit
0 Comments